﻿using XinLife.Application.Interface;
using XinLife.Model;
using XinLife.Model.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNetCore.Mvc;
using XinLife.Core.Model;

namespace XinLife.Controllers.Admin
{
    public class CodeController : BaseController
    {
        ICodeService _codeService;
        public CodeController(ICodeService codeService)
        {
            _codeService = codeService;
        }
        [HttpGet]
        public Task<PageData<object>> GetTablePageList([FromQuery] Pagination pagination, [FromQuery] string queryJson = null)
        {
            return _codeService.GetTablePageList(pagination, queryJson);
        }
        [HttpGet]
        public async Task<AjaxResult> GetTableFiled([FromQuery]string tableName)
        {
            return await _codeService.GetTableFiled(tableName);
        }
        [HttpPost]
        public async Task<AjaxResult> CodeGenerate([FromForm]CodeGenerateInputDto dto)
        {
            var data = await _codeService.CodeGenerate(dto);
            return Success(data);
        }
        [HttpPost]
        public async Task<AjaxResult> SaveMenu([FromForm]CodeGenerateInputDto dto)
        {
            return await _codeService.SaveMenu(dto);
        }
    }
}
